#ifndef I_MATERIAL_HPP
#define I_MATERIAL_HPP

#include "../Math.hpp"
#include "../Model/VertexStructure.hpp"
#include "../Program/ProgramState.hpp"

namespace Material {

class MaterialBase {
public:
  /* 创建一个默认材质 */
  MaterialBase();

  /* 设置给定的program */
  MaterialBase(const Program::ProgramRef &program, const std::string &name = "Default");

  ~MaterialBase();

  /* 设置program */
  void SetProgram(Program::ProgramRef &program) { _program = program; }

  /* 获取program */
  auto GetProgram() const { return _program; }

  /* 获取材质名 */
  std::string GetName() const { return _name; }

  /* 设置材质名 */
  void SetName(const std::string &name) { _name = name; }

  /* 设置颜色 */
  void SetColor(glm::vec4 color) { _color = color; }

  /* 获取颜色 */
  glm::vec4 GetColor() const { return _color; }

  virtual void Apply();

  virtual void UpdateProperties();

protected:
  std::string _name;
  glm::vec4 _color;
  Program::ProgramRef _program;
};

} // namespace Material

#endif